package com.yibai.web.app.controller;


import com.yibai.web.app.service.CategoryService;
import com.yibai.web.dto.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fang
 * @since 2021-04-19
 */
@RestController
@Api(value = "文章管理",tags = {"文章管理"})
@RequestMapping("/app/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @PostMapping("/list")
    @ApiOperation(value = "分类列表" ,notes = "")
    public SuperResponse list(@Valid @RequestBody CategoryListRequest request ){
        return categoryService.list(request);
    }

    @PostMapping("/info")
    @ApiOperation(value = "分类详情" ,notes = "")
    public SuperResponse info(@Valid @RequestBody CategoryRequest request ){
        return categoryService.info(request);
    }

    @PostMapping("/add")
    @ApiOperation(value = "分类添加" ,notes = "")
    public SuperResponse add(@Valid @RequestBody CategoryInfoRequest request ){
        return categoryService.add(request);
    }

    @PostMapping("/update")
    @ApiOperation(value = "分类修改" ,notes = "")
    public SuperResponse update(@Valid @RequestBody CategoryInfoRequest request ){
        return categoryService.update(request);
    }

}

